const config = {
	// dev
	api_base_url: 'http://192.168.1.110:9012/',
	api_base_url_tools: 'http://192.168.1.110:9019/',

	//pro
	// api_base_url: 'https://mashangjie.shop/',
	// api_base_url_tools: 'http://mashangjie.shop:9019/',
	oss_base_url:'https://mashangjie.oss-cn-qingdao.aliyuncs.com/',
}
const myGetDistance = function GetDistance(lat1, lng1, lat2, lng2) {
	var radLat1 = lat1 * Math.PI / 180.0
	var radLat2 = lat2 * Math.PI / 180.0
	var a = radLat1 - radLat2
	var b = lng1 * Math.PI / 180.0 - lng2 * Math.PI / 180.0
	var s = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(a / 2), 2) + Math.cos(radLat1) * Math.cos(radLat2) * Math.pow(Math.sin(
		b / 2), 2)))
	s = s * 6378.137
	s = Math.round(s * 10000) / 10000
	return s
}

const yourFormatDateTime = function formatDateTime(timeStamp) {
	var date = new Date()
	date.setTime(timeStamp) // 精确到毫秒、如果没有到毫秒就 date.setTime(timeStamp*1000);
	var y = date.getFullYear()
	var m = date.getMonth() + 1
	m = m < 10 ? ('0' + m) : m
	var d = date.getDate()
	d = d < 10 ? ('0' + d) : d
	var h = date.getHours()
	h = h < 10 ? ('0' + h) : h
	var minute = date.getMinutes()
	var second = date.getSeconds()
	minute = minute < 10 ? ('0' + minute) : minute
	second = second < 10 ? ('0' + second) : second
	return y + '-' + m + '-' + d + ' ' + h + ':' + minute + ':' + second
}
export {
	config,
	myGetDistance,
	yourFormatDateTime
}
